home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
shufflc.exe
/
SHUFFELC.DOC
< prev
next >
Wrap
Text File
|
1991-11-06
|
6KB
|
114 lines
Shuffelc shuffels a normal deck of 52 playing cards and deals out a
single hand of cards. The shuffel-and-deal sequence can be repeated
by providing an optional command line argument (no_times). The number
of cards dealt defaults to the usual 5-card poker hand which will be
scored as described below. However, a second optional command line
argument (hand_size) can change the number of cards dealt to any
desired number from 1 to 52.
Incorrect command lines such as:
shuffelc HELP
will produce the usage screen below:
Bad command-line argument HELP
USAGE: shuffelc [no_times [hand_size] ]
Shuffels a 52 card deck and deals a hand of size
hand_size (default is 5). Shuffel & deal is repeated
no_times times (default is 1).
EXAMPLE: shuffelc
might give 3 : King-SP Four-CL Four-DI Eight-DI Four-HT
where 3-Fours rank #3 on Hoyle's scale of 0 (nothing)
to 9 (Royal Flush).
The card shuffel is performed simply by assigning each of the 52 cards
a random number. The cards are then sorted by this random number to
complete the shuffel. I've used the sort method of D.L. Shell which
seems to give good in-memory sorts of smaller lists.
In addition to its gaming applications, shuffelc can also test your
random number generator. Normal poker-hand tests simply check the
number of nothing, one-pair, two-pairs etc. combintions of the digits
0 - 9. We've got real poker hands, so the comparison is with Hoyle's
Games table below.
Shuffelc Scoring Hoyle's Games pg. 100
Value Count Pct. Value Count Pct.
0 4,998 50.0 0 1,302,540 50.1 Nothing
1 4,252 42.5 1 1,098,240 42.3 One Pair
2 476 4.8 2 123,552 4.8 Two Pairs
3 203 2.0 3 54,912 2.1 Three of a Kind
4 40 0.4 4 10,200 0.4 Straight
5 19 0.2 5 5,108 0.2 Flush
6 9 0.1 6 3,744 0.1 Full House
7 3 0.0 7 624 0.0 Four of a Kind
8 0 8 36 0.0 Straight Flush
9 0 9 4 0.0 Royal Flush
Total 10000 Total 2,598,960
TEST OUTPUT:
BSD 4.3 K&R C Borland C MicroSoft C SCO UNIX-V MSC
0 2466 49.3 0 2498 50.0 0 2439 48.8 0 2530 50.6
1 2158 43.2 1 2127 42.5 1 2179 43.6 1 2045 40.9
2 235 4.7 2 236 4.7 2 240 4.8 2 276 5.5
3 108 2.2 3 99 2.0 3 112 2.2 3 98 2.0
4 17 0.3 4 19 0.4 4 17 0.3 4 28 0.6
5 12 0.2 5 9 0.2 5 6 0.1 5 12 0.2
6 4 0.1 6 11 0.2 6 4 0.1 6 10 0.2
7 0 7 1 0.0 7 3 0.1 7 1 0.0
Tot. 5000 Total 5000 Total 5000 Total 5000
COMPILE COMMANDS USED FOR ABOVE:
cc -DBSD43 -o shuffelc shuffelc.c
bcc -DANSIC shuffelc.c
cl /AL /DANSIC shuffelc.c
cc -DANSIC shuffelc.c
w.howell CIS 70215,206 11/6/91
----------------end-of-author's-documentation---------------
Software Library Information:
This disk copy provided as a service of
Public (software) Library
We are not the authors of this program, nor are we associated
with the author in any way other than as a distributor of the
program in accordance with the author's terms of distribution.
Please direct shareware payments and specific questions about
this program to the author of the program, whose name appears
elsewhere in this documentation. If you have trouble getting
in touch with the author, we will do whatever we can to help
you with your questions. All programs have been tested and do
run. To report problems, please use the form that is in the
file PROBLEM.DOC on many of our disks or in other written for-
mat with screen printouts, if possible. PsL cannot debug pro-
programs over the telephone, though we can answer questions.
Disks in the PsL are updated monthly, so if you did not get
this disk directly from the PsL, you should be aware that the
files in this set may no longer be the current versions. Also,
if you got this disk from another vendor and are having prob-
lems, be aware that some files may have become corrupted or
lost by that vendor. Get a current, working disk from PsL.
For a copy of the latest monthly software library newsletter
and a list of the 3,000+ disks in the library, call or write
Public (software) Library
P.O.Box 35705 - F
Houston, TX 77235-5705
1-800-2424-PSL
MC/Visa/AmEx/Discover
Outside of U.S. or in Texas
or for general information,
Call 1-713-524-6394
PsL also has an outstanding
catalog for the Macintosh.